package com.example.service;

import com.example.entity.MedicalStaff;
import com.example.mapper.MedicalStaffMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicalStaffService {
    
    @Autowired
    private MedicalStaffMapper medicalStaffMapper;

    public void addMedicalStaff(MedicalStaff staff) {
        medicalStaffMapper.insert(staff);  // 创建工作人员
    }

    public MedicalStaff getMedicalStaffById(int id) {
        return medicalStaffMapper.selectById(id);  // 查询工作人员
    }

    public List<MedicalStaff> getAllMedicalStaff() {
        return medicalStaffMapper.selectList(null);  // 查询所有工作人员
    }

    public void updateMedicalStaff(MedicalStaff staff) {
        medicalStaffMapper.updateById(staff);  // 更新工作人员
    }

    public void deleteMedicalStaff(int id) {
        medicalStaffMapper.deleteById(id);  // 删除工作人员
    }
}
